package event
{
	
	import flash.events.*;
	
	/**
	 * -- EvtDispatcher --
	 * @desc	view of stage list
	 * @author	Aqua (built on 2011-11-25)
	 */
	public class EvtDispatcher extends EventDispatcher
	{
		//---------------------//
		//      Singleton      //
		//---------------------//
		
		/**************************************************************************
		 * -- (getter) instance --
		 * @desc		get singleton of this class
		 * @return		singleton of this class
		 *************************************************************************/
		public static function get instance():EvtDispatcher
		{
			if (null == _instance)
			{
				_instance = new EvtDispatcher(singleton);
			}
		
			return _instance;
		}
		
		/**************************************************************************
		 * -- singleton --
		 * @desc		a private function used to enforce singlton
		 *************************************************************************/
		private static function singleton():void
		{
			
		}
		
		
		//---------------------//
		//     Constructor     //
		//---------------------//
		
		/**************************************************************************
		 * -- EvtDispatcher --
		 * @desc		constructor
		 * @param		(s) a private function used to enforce singlton
		 *************************************************************************/
		public function EvtDispatcher(s:Function = null):void
		{
			if (singleton != s)
			{
				throw new Error("This is a singleton class!");
			}
		}
		
		
		//-----------------//
		//     Publics     //
		//-----------------//
		
		/**************************************************************************
		 * -- dispatch --
		 * @desc		dispatch a event
		 * @param		(evt) name of the event
		 *************************************************************************/
		public function dispatch(evt:String):void
		{
			this.dispatchEvent(new Event(evt));
		}
		
		
		//------------------//
		//     Privates     //
		//------------------//
		
		
		private static var _instance:EvtDispatcher;
	}
	
}